package com.study.object.demo;

import com.study.common.entity.Model;
import org.openjdk.jol.info.ClassLayout;

public class ObjectTest {

    public static void main(String[] args) {
        Model m = new Model();
//        //打印class对象信息
//        System.out.println(ClassLayout.parseClass(Model.class).toPrintable());
//        //答应对象信息
//        System.out.println(ClassLayout.parseInstance(m).toPrintable());
//        //获取hashCode
//        System.out.println(m.hashCode());
//        //获取identityHashCode
//        System.identityHashCode(m);
//        //获取hashCode后打印对象信息
//        System.out.println(ClassLayout.parseInstance(m).toPrintable());
//        Model[] ms = new Model[10];
//        //打印数组对象信息
//        System.out.println(ClassLayout.parseInstance(ms).toPrintable());

//        //打印string对象信息
//        System.out.println(ClassLayout.parseInstance("123").toPrintable());
//        //打印string对象信息
//        System.out.println(ClassLayout.parseInstance(new String("123")).toPrintable());
        //打印int类型
        System.out.println(ClassLayout.parseInstance(1).toPrintable());
        //打印Long类型
        System.out.println(ClassLayout.parseInstance((long) 1).toPrintable());
    }
}
